home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0226_Registry - Add-Change Setting.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-03-04  |  670 b   |  29 lines

  1.  
  2. function RegGetStr( sKey, sItem, sDefVal : string ) : string;
  3. var
  4.   reg : TRegIniFile;
  5. begin
  6.   reg := TRegIniFile.Create( sKey );
  7.   Result := reg.ReadString( '', sItem, sDefVal );
  8.   reg.Free;
  9. end;
  10.  
  11. procedure RegSetStr( sKey, sItem, sVal : string );
  12. var
  13.   reg : TRegIniFile;
  14. begin
  15.   reg := TRegIniFile.Create( sKey );
  16.   reg.WriteString( '', sItem, sVal + #0 );
  17.   reg.Free;
  18. end;
  19.  
  20. // now, you can call above helper functions like you wanted:
  21. //
  22.  
  23. {ATextBox.Text :=3D RegGetStr( 'Software\MyCompanyName\MyProductName',
  24. 'variable1', 'default value goes here' );
  25.  
  26. RegSetStr( 'Software\MyCompanyName\MyProductName', 'variable1',
  27. ATextBox.Text );}
  28.  
  29.